home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ARexxTools / fpl70.lha / docs / fpl.doc next >
Encoding:
Text File  |  1994-04-10  |  38.7 KB  |  1,132 lines

  1. TABLE OF CONTENTS
  2.  
  3. fpl.library/fplAddFunction
  4. fpl.library/fplAlloc
  5. fpl.library/fplAllocString
  6. fpl.library/fplAlloca
  7. fpl.library/fplCloseLib
  8. fpl.library/fplConvertString
  9. fpl.library/fplDealloc
  10. fpl.library/fplDealloca
  11. fpl.library/fplDelFunction
  12. fpl.library/fplExecuteFile
  13. fpl.library/fplExecuteScript
  14. fpl.library/fplFree
  15. fpl.library/fplFreeString
  16. fpl.library/fplGetErrorMsg
  17. fpl.library/fplInit
  18. fpl.library/fplOpenLib
  19. fpl.library/fplReset
  20. fpl.library/fplSend
  21. fpl.library/fplConvertString                     fpl.library/fplConvertString
  22.  
  23.    NAME
  24.     fplConvertString -- convert FPL string to binary.
  25.  
  26.    SYNOPSIS
  27.     long fplConvertString( key, convert, buffer );        (V4)
  28.     D0               A0   A1       A2
  29.  
  30.    FUNCTION
  31.     Convert a FPL syntax string to a binary string. *ALL* in FPL allowed
  32.     backslash sequences are supported. The string to convert can begin and
  33.     end with an optional quotation mark ("). Zero terminated string is
  34.     also accepted.
  35.  
  36.     The output will be stored in the buffer given as input. FPL also adds
  37.     a terminating zero to the output string.
  38.  
  39.    RESULT
  40.     The number of characters in the output string. The terminating zero
  41.     excluded.
  42.  
  43.    INPUTS
  44.     void *key    - Return value from fplInit().
  45.     vhar *convert    - String to convert to binaries.
  46.     char *buffer    - Pointer to buffer large enough to hold the resulting
  47.               string plus an additional zero terminate byte.
  48.  
  49. fpl.library/fplExecuteScript                     fpl.library/fplExecuteScript
  50.  
  51.    NAME
  52.     fplExecuteScript -- execute an FPL program.
  53.     fplExecuteScriptTags -- execute an FPL program.
  54.  
  55.    SYNOPSIS
  56.     long fplExecuteScript( key, program, lines, tags );
  57.     D0                  A0   A1         D0     A2
  58.  
  59.     For SAS/C users:
  60.     long fplExecuteScriptTags( key, program, lines, ... );
  61.  
  62.    FUNCTION
  63.     This function executes the program (array of char pointers) pointed
  64.     to by the program parameter according to the rules set by the
  65.     call to fplInit(). Each line must end with a zero (0) byte.
  66.     If any error occurs, the function returns proper error code (see
  67.     FPL.h).
  68.  
  69.     If the program is started and is expected only to run once and then to
  70.     be removed from memory, use the FPLTAG_STOREGLOBALS tag to disable any
  71.     global symbol storage.
  72.  
  73.     The tag list pointer is new for V3.
  74.  
  75.    TAGS
  76.     FPLTAG_INTERPRET
  77.       This data is interpreted after all declaring and prototyping has been
  78.       done in the FPL program. NULL will disable. Mainly implemented to
  79.       enable single function invokes within a larger program. The data of
  80.       this tag is to be looked upon as a string argument to an interpret()
  81.       function call. After this interpret() call, the FPL program will
  82.       exit.
  83.         This example calls only the function named foobar (with 2 and 3
  84.         as parameters) within the much larger program:
  85.  
  86.         unsigned long tags={
  87.           FPLTAG_INTERPRET, "foobar(2, 3);", FPLTAG_DONE
  88.         };
  89.         fplExecuteScript(anchor, programarray, 200, tags);
  90.  
  91.       NOTE: This intepreted statement will act *EXACTLY* as if it is
  92.       interpreted by the program right before the actual start of the main
  93.       program. If you call any inside function, it *must* be prototyped
  94.       properly first or else this will fail!
  95.  
  96.       HINT: This enables a beautilful way for us to send arguments to the
  97.       FPL functions. By making the main function including prototyping just
  98.       as any other function. Invoke the following example with the tag
  99.       {FPLTAG_INTERPRET, "main(22, \"Daniel\");"} and you see my point!
  100.         Example:
  101.  
  102.         int main(int, string);
  103.         exit(-1);    /* just to prevent normal starts */
  104.         int main(int age, string name)
  105.         {
  106.            output(name " is " age " years old!\n");
  107.         }
  108.  
  109.  
  110.     FPLTAG_STARTPOINT.
  111.       By setting this pointer you can force FPL to start interpreting at
  112.       another position than from the start of the program. If this start
  113.       position is on any other line than the first, FPLTAG_STARTLINE must
  114.       be set too.
  115.  
  116.     FPLTAG_STARTLINE
  117.       Set this only if you set the FPLTAG_STARTPOINT tag. By only setting
  118.       this tag, you achieve nothing but confusing the interpreter.
  119.  
  120.       NOTE regarding these upper two tags: when changing the interpreting
  121.       start position you must think of that the variable declarations
  122.       and/or function prototyping that may be written in the original
  123.       start of program might get passed.
  124.  
  125.     FPLTAG_USERDATA
  126.       Does the same as when used in fplInit() or fplReset().
  127.  
  128.     FPLTAG_CACHEFILE
  129.       Turn on or off FPL caching of this file. Default is set with the
  130.       'FPLTAG_CACHEALLFILES' in a fplInit() or a previous fplReset()
  131.       call. Its default is FPLCACHE_NONE.
  132.  
  133.       Cashing can be done in three ways:
  134.       FPLCACHE_NONE    - Will never ever cache a file
  135.       FPLCACHE_ALWAYS  - Will cache files that have one or more global
  136.                  symbols
  137.       FPLCACHE_EXPORTS - Will only cache files that have exported symbols.
  138.  
  139.       NOTE: Files that do not declare any global symbols will not be
  140.       cached, no matter what this tag says!
  141.  
  142.     FPLTAG_FILEGLOBALS/FPLTAG_ISCACHED
  143.       Supply this tag a pointer to a `long'. This variable will tell if the
  144.       progam declared any global symbols, which is the same as if it is to
  145.       be cached. The long will contain zero if no global symbols were
  146.       declared or non-zero if a not known number of variables were
  147.       declared.
  148.  
  149.     FPLTAG_PROGNAME
  150.       Name of the FPL program. When using multiple FPL source files it is
  151.       almost required to use this tag. If any error occurs when running
  152.       FPL, the FPLSEND_GETPROGNAME will receive a pointer to the program
  153.       name (or "<unknown program>" if it is never set). fplExecuteFile()
  154.       sets the program name by default to the file name. Programs without
  155.       names can never be cached!
  156.  
  157.     FPLTAG_FILENAMEGET
  158.       Tells FPL that when this file has been flushed, the program can be
  159.       found by using the program name as file name to read from. Set as
  160.       default be fplExecuteFile().
  161.  
  162.     FPLTAG_STRING_RETURN                    (V6)
  163.       Supply a pointer to a char pointer. This enables the started FPL
  164.       programs to return a string to you. The string can be returned from
  165.       the main (highest) level of the FPL program with "return" or from
  166.       any level with "exit". The string will be readable just like any
  167.       regular string from FPL. The FPL_STRLEN macro will give to the
  168.       length of the returned string.
  169.  
  170.       Programs that are executed with this tag set will not be able to
  171.       return any other data than a string! Using the FPLSEND_GETRETURNCODE
  172.       tag in a fplSend() call will not return a valid number!
  173.  
  174.       The string is to be treated exactly as fplAllocString() strings:
  175.       you must fplFreeString() it when you have finished using it. The
  176.       string can even be used with the FPLSEND_DONTCOPY_STRING tag to
  177.       the fplSend() call!
  178.  
  179.    RESULT
  180.     The error number, or zero (0) if everything was ok.
  181.  
  182.    INPUTS
  183.     void *key        - Return value from fplInit().
  184.     char **program        - The FPL program to execute.
  185.     long lines        - Number of lines in the program.
  186.     unsigned long *tags     - Pointer to a tag list.
  187.  
  188.    SEE ALSO
  189.     fplExecuteFile
  190.  
  191. fpl.library/fplExecuteFile                       fpl.library/fplExecuteFile
  192.  
  193.    NAME
  194.     fplExecuteFile -- execute a file as an FPL program.
  195.     fplExecuteFileTags -- execute a file as an FPL program.
  196.  
  197.    SYNOPSIS
  198.     long fplExecuteFile( key, filename, tags );
  199.     D0               A0      A1        A2
  200.  
  201.     For SAS/C users:
  202.     long fplExecuteFileTags( key, filename, ... );
  203.  
  204.    FUNCTION
  205.     This function executes the file with the name pointed to by the
  206.     filename parameter according to the rules set by the fplInit()
  207.     function call. If any error occurs, the subroutine returns.
  208.     The program is loaded into memory before execution. If the program
  209.     didn't export any functions or if it shouldn't be cached, it will be
  210.     unloaded when the program exits.
  211.  
  212.     fplExecuteFile() will internally read the given file and then call
  213.         fplExecuteScript().
  214.  
  215.    TAGS
  216.     The tags are the same as for fplExecuteScript().
  217.  
  218.    RESULT
  219.     The error number, or zero (0) if everything was ok.
  220.  
  221.    INPUTS
  222.     void *key        - Return code from fplInit().
  223.     char *filename        - Pointer to the filename.
  224.     unsigned long *tags     - Pointer to a tag list.
  225.  
  226.    SEE ALSO
  227.     fplExecuteScript()
  228.  
  229. fpl.library/fplGetErrorMsg                        fpl.library/fplGetErrorMsg
  230.  
  231.    NAME
  232.     fplGetErrorMsg -- get error message from error number.
  233.  
  234.    SYNOPSIS
  235.     char *fplGetErrorMsg( key, errnum, buffer );
  236.     D0                A0   D0      A1
  237.  
  238.    FUNCTION
  239.     To get a verbose error message from the error number returned by
  240.     fplExecuteScript() or fplExecuteFile().
  241.     Giving this function a error number out of range, will cause the
  242.     library to return "Unknown" error. The buffer given to hold the error
  243.     message must be at least FPL_ERRORMSG_LENGTH bytes long.
  244.  
  245.    NOTE
  246.     This will be transfered into a tag to the fplSend() function.
  247.  
  248.    RESULT
  249.     A pointer to a zero terminated string.
  250.  
  251.    INPUTS
  252.     void *key    - The return code of the initial fplinit() call.
  253.     long errnum    - Error number to get error message for.
  254.     char *buffer    - Buffer to store message in.
  255.  
  256.    SEE ALSO
  257.     fplExecuteScript(), fplExecuteFile()
  258.  
  259. fpl.library/fplAddFunction                   fpl.library/fplAddFunction
  260.  
  261.    NAME
  262.     fplAddFunction -- add function to be recognized by FPL.
  263.     fplAddFunctionTags -- add function to be recognized by FPL.
  264.  
  265.    SYNOPSIS
  266.     long fplAddFunction( key, name, ID, ret, format, tags );
  267.     D0                   A0   A1    D0  D1   A2      A3
  268.  
  269.     For SAS/C users:
  270.     long fplAddFunctionTags( key, name, ID, ret, format, ... );
  271.  
  272.    FUNCTION
  273.     This function adds a function to the FPL internal list of functions
  274.     to accept. All data pointed to by the different pointers here, must
  275.     remain unmodified (or at least existent, they may be changed any time
  276.     but the proper syntax must be respected) while FPL runs.
  277.  
  278.     DO NOT add function identifiers with names longer than 64 characters.
  279.     Such function won't be recognized in an FPL program.
  280.  
  281.     This function will be remembered as a function by FPL until fplFree()
  282.     (or fplDelFunction() naming this function) is invoked.
  283.  
  284.     To achieve dynamic function names which might change during the
  285.     execution or from one execution time to the next, you can call this
  286.     function whenever you please and the function will be accepted when FPL
  287.     gets control again. To remove a function, use fplDelFunction(). You
  288.     can do this at _any_ time, even in the middle of an execution!)
  289.  
  290.     If you want to add a function with the same name as an internal
  291.     function, or simply replace it, just fplDelFunction() the internal
  292.     function and then add your own using that name!
  293.  
  294.    TAGS
  295.     * FPLTAG_FUNCDATA. This data is readable in the ->funcdata member of
  296.       the fplArgument structure whenever this function is invoked. This
  297.       gives you a great chance to pass local data between here and your
  298.       interface function.
  299.  
  300.     * FPLTAG_FUNCTION. This is a function specific function pointer to be
  301.       called when this function is found in the FPL program. This enables
  302.       unique function calls for each function you add to FPL. The function
  303.       specified is called with the same argument and permissions as the
  304.       `global' interface function.
  305.  
  306.    RESULT
  307.     Zero if success, error code if failure.
  308.  
  309.    INPUTS
  310.     void *key    - This is the data received from the initial
  311.               fplInit() function call.
  312.  
  313.     char *name    - Pointer to a zero terminated string holding the
  314.               name of the function to add.
  315.  
  316.     long ID        - Function ID. May be set to whatever you please to
  317.               speed up function checks in the interface function.
  318.               All subzero values are reserved for FPL use and
  319.               calls.
  320.  
  321.     char ret    - FPL_STRARG or FPL_INTARG depending on if this
  322.               function is to return a string or an int to the
  323.               caller. FPL_OPTARG means that the function can
  324.               return either a string or an int. The return type
  325.               is determined by FPL at run time, and you help a
  326.               lot by *always* returing values from such functions
  327.               since each fplSend() will tell FPL the kind of the
  328.               return value.
  329.  
  330.     char *format    - This is a pointer to a zero terminated array holding
  331.               the argument specifiers for this function. You can
  332.               make your function receive for types of arguments:
  333.               strings, integers, string variables or integer
  334.               variables. You can also specify optional parameters
  335.               and/or parameter list. Available argument types are
  336.               - FPL_STRARG (required 'string')
  337.               - FPL_STRARG_OPT (optional 'string')
  338.               - FPL_INTARG (required 'int')
  339.               - FPL_INTARG_OPT (optional 'int')
  340.               - FPL_OPTARG (required 'string' OR 'int')
  341.               - FPL_OPTARG_OPT (optional 'string' OR 'int')
  342.               - FPL_ARGLIST (optional number of the previous type
  343.                 can be specified)
  344.  
  345.               NOTE: the optional kinds *must* be specified to the
  346.               right of the required ones!
  347.  
  348.               Examples:
  349.  
  350.               {FPL_INTARG, FPL_STRARG, FPL_INTARG_OPT, 0}
  351.               means one required int, one required string
  352.               and one optional int.
  353.  
  354.               {FPL_STRARG, FPL_INTARG_OPT, FPL_ARGLIST, 0}
  355.               means one required string and any number of
  356.               optional ints.
  357.  
  358.     unsigned long *tags - Pointer to a tag list. See TAGS
  359.  
  360.    SEE ALSO
  361.     fplDelFunction()
  362.  
  363. fpl.library/fplDelFunction                       fpl.library/fplDelFunction
  364.  
  365.    NAME
  366.     fplDelFunction -- remove function definition.
  367.  
  368.    SYNOPSIS
  369.     long fplDelFunction( key, name );
  370.     D0                   A0   A1
  371.  
  372.    FUNCTION
  373.     As the name hints you about, this function removes a named
  374.     function from the FPL internal identifier cach. After this
  375.     call the named function will no longer be recognized.
  376.  
  377.     You can do this with any of the internal FPL functions too,
  378.     which has to be done if you want to add your own function
  379.     using the same name as a FPL internal function (or replacing
  380.     it with one which you think work better).
  381.  
  382.     NOTE: You don't have to fplDelFunction() every function you
  383.     have fplAddFunction()'ed. fplFree() will take care of that
  384.     for you.
  385.  
  386.    RESULT
  387.     Zero if everything was ok, otherwise an error code.
  388.  
  389.    INPUTS
  390.     void *key    - The return code of the initial fplInit().
  391.     char *name    - Pointer to the function name (zero terminated).
  392.  
  393.    SEE ALSO
  394.     fplAddFunction()
  395.  
  396. fpl.library/fplFree                                     fpl.library/fplFree
  397.  
  398.    NAME
  399.     fplFree -- clean up all resources used by FPL.
  400.  
  401.    SYNOPSIS
  402.     void fplFree( key );
  403.               A0
  404.  
  405.    FUNCTION
  406.     When you have used FPL for the last time in your program, use
  407.     this function to make FPL free it's internal buffers and resources.
  408.     This call will make the data received from the initial fplInit()
  409.     useless.
  410.  
  411.     NOTE: You do not have to make a fplDelFunction() for every
  412.     function you've added. It's enough with a call to fplFree().
  413.  
  414.     NOTE2: If you intend to use FPL again in the same session, avoid
  415.     the overhead of doing fplFree() after every invoke of an FPL program.
  416.     My suggestion is, in all normal cases, an fplInit() call when starting
  417.     your program and an fplFree() call just before you exit it.
  418.  
  419.    INPUTS
  420.     void *key    - The return code of the initial fplInit().
  421.  
  422.    SEE ALSO
  423.     fplInit()
  424.  
  425. fpl.library/fplInit                                    fpl.library/fplInit
  426.  
  427.    NAME
  428.     fplInit -- intializes an FPL usage session.
  429.  
  430.    SYNOPSIS
  431.     void *fplInit( function, tags );
  432.  
  433.     void *fplInitTags( function, ... );
  434.  
  435.    FUNCTION
  436.     This function initializes the FPL internal buffers and caches and
  437.     allocates the new stack to use when the library is invoked.
  438.     This function *MUST* be called the first thing you do when you want
  439.     to use any functions in FPL. The return code of this function is
  440.     used as parameters in several of the other FPL functions. Can be called
  441.     several times using the same library base if wanted.
  442.  
  443.     Each call to fplInit() should have a corresponding call to fplFree().
  444.  
  445.    TAGS
  446.     * FPLTAG_ALLFUNCTIONS                    (V5.3)
  447.       This tag enables/disables the FPL_UNKNOWN_FUNCTION ID. If that ID is
  448.       sent to the interface function, it means that the function just
  449.       interpreted was not found in the FPL internal lists. When this tag
  450.       is enabled, all function names will always be interpreted as best as
  451.       it can be done, no functions will be reported as "identified
  452.       unknown". Default is disabled.
  453.  
  454.     * FPLTAG_HASH_TABLE_SIZE                (V5)
  455.       Specified the size of the hash table to use. Default is 67, and any
  456.       size below 10 is ignored. Set this *ONLY* at the fplInit() call!!!
  457.       Highest performance will be achieved if this is a prime number.
  458.  
  459.     * FPLTAG_INTERVAL.
  460.       Specifies the interval function which is called every now and then
  461.       to enable external processes to stop the FPL program. Returning
  462.       non-zero stops the program with a FPL_PROGRAM_STOPPED error code.
  463.  
  464.     * FPLTAG_NEWLINE_HOOK                    (V5)
  465.       Specifies the function to call on every newline that the interpreter
  466.       passes. NULL disables. The function called should return a standard
  467.       FPL error code.
  468.  
  469.     * FPLTAG_USERDATA.
  470.       Data to send to the interval function. Readable with the
  471.       FPLSEND_USERDATA tag to the fplSend() function.
  472.  
  473.     * FPLTAG_INTERNAL_ALLOC.                (V3)
  474.       With this tag you specify a function pointer that will be called
  475.       instead of the internal AllocMem()/malloc() function. This has to be
  476.       a "void *(*function)(long size)" function. Amiga programmers will
  477.       find the size argument in register D0.
  478.  
  479.       When using this, all FPL allocations will be made using this
  480.       function, although FPL has it's own memory caching/recycling system.
  481.  
  482.     * FPLTAG_INTERNAL_DEALLOC.                (V3)
  483.       Specifies a function pointer to be called instead of the internal
  484.       FreeMem()/free() function. The function must be a
  485.       "void (*function)(void *pointer, long size)" function. Amiga
  486.       programs will receive the arguments in A1 and D0 (just as FreeMem()
  487.       wants them...).
  488.  
  489.     * FPLTAG_CACHEALLFILES.                    (V3)
  490.       Turn on or off default FPL caching. Default is FPLCACHE_NONE.
  491.  
  492.       Cashing can be done in three ways:
  493.       FPLCACHE_NONE    - Will never ever cache a file
  494.       FPLCACHE_ALWAYS  - Will cache files that have one or more global
  495.                  symbols
  496.       FPLCACHE_EXPORTS - Will only cache files that have exported symbols.
  497.  
  498.       (The execute tag 'FPLTAG_CACHEFILE' can change this on a single
  499.       program basis. FPLTAG_CACHEALLFILES sets the default cache switch.)
  500.  
  501.       NOTE: Files that do not declare any global symbols will not be
  502.       cached, no matter what this tag says!
  503.  
  504.  
  505.       Amiga-only tags:
  506.  
  507.     * FPLTAG_STACK.
  508.       Startup stack size. Any size below 8000 bytes is ignored!
  509.  
  510.     * FPLTAG_MAXSTACK.
  511.       After one execution with possible stack expandings, this specified
  512.       size is the maximum memory area that still will be allocated by FPL
  513.       to use in the next execution as stack. (This is done like this to
  514.       prevent FPL to have to enlarge the stack on every execution if
  515.       memory is available!) Default is 20000 bytes.
  516.  
  517.     * FPLTAG_STACKLIMIT.
  518.       The very largest memory size that FPL is permitted to use as stack.
  519.       This prevents the user of writing too recursive FPL programs. Try a
  520.       few programs to see which setting you think fits best in your
  521.       surrounding. Default is 40000 bytes.
  522.  
  523.     * FPLTAG_MINSTACK.
  524.       The very least stack size that you want free when the interface
  525.       function is called. Eg, if your interface function uses 2000 bytes
  526.       of stack, then set this tag to allocate at least 2000 bytes before
  527.       calling the interface function. Default is 1000 bytes.
  528.  
  529.     * FPLTAG_LOCKUSED.
  530.       This tag makes FPL to keep the lock on a file until it doesn't need
  531.       the file anymore. Using this tag enables a higher security level of
  532.       the FPL environment since no files can be removed or changed while
  533.       they are needed by FPL. Locks will be removed when the program is
  534.       not necessary any more or when fplFree() is called.
  535.  
  536.    NOTE
  537.     *WARNING* FPLTAG_INTERNAL_ALLOC and FPLTAG_INTERNAL_DEALLOC can be
  538.     patched run-time. If you do that, memory that has been allocated using
  539.     the first function, might get freed by the new patch. This can be
  540.     looked upon as a bug, but sure as well a feature. THESE TAGS MUST BE
  541.     USED WITH CAUTION!
  542.  
  543.    RESULT
  544.     Non-zero if everything was ok, otherwise NULL. This return code is used
  545.     as input to all other FPL functions. Don't mess with it!
  546.  
  547.     The return code will remain the same during the entire FPL session.
  548.     That enables you to store this in a global variable to be able to reach
  549.     it everywhere without problems.
  550.  
  551.    INPUTS
  552.     long (*function)(struct fplArgument*) - Pointer to the interface
  553.                         function.
  554.     unsigned long *tags              - Taglist pointer!
  555.  
  556.    SEE ALSO
  557.     fplReset(), fplFree()
  558.  
  559. fpl.library/fplReset                                    fpl.library/fplReset
  560.  
  561.    NAME
  562.     fplReset -- reset tags set in the fplInit() call.
  563.     fplResetTags -- reset tags set in the fplInit() call.
  564.  
  565.    SYNOPSIS
  566.     long fplReset( key, tags );
  567.     D0           A0   A1
  568.  
  569.     For SAS/C users:
  570.     long fplResetTags( key, ... );
  571.  
  572.    FUNCTION
  573.     This function is used to set fplInit() tags, after the fplInit() call.
  574.     If you'd like to change any given data or perhaps add a tag dynamically
  575.     between two FPL runs, this is the function for you!
  576.  
  577.    TAGS
  578.     All fplInit() tags are available.
  579.  
  580.    RESULT
  581.     Zero if ok, otherwise a non-zero error code!
  582.  
  583.    INPUTS
  584.     void *key        - The return code of the initial fplInit().
  585.     unsigned long *tags    - Taglist pointer!
  586.  
  587.    SEE ALSO
  588.     fplInit()
  589.  
  590. fpl.library/fplSend                                     fpl.library/fplSend
  591.  
  592.    NAME
  593.     fplSend -- multi purpose FPL communication.
  594.     fplSendTags -- multi purpose FPL communication.
  595.  
  596.    SYNOPSIS
  597.     long fplSend( key, tags );                (V3)
  598.     D0            A0   A1
  599.  
  600.     For SAS/C users:
  601.     long fplSendTags( key, ... );
  602.  
  603.    FUNCTION
  604.     There is always communication between FPL and the host program. FPL
  605.     communicates by calling the interface function, you answer by calling
  606.     fplSend() with different arguments. This is the general function for
  607.     responding to, or getting information from, FPL.
  608.  
  609.     To return values to FPL from the interface function use this. Only use
  610.     one of the data sending tags in the same function call (tags marked
  611.     with "**").
  612.  
  613.     The tags are read in the same order as sent. That means that you can,
  614.     in cases where you should specify several tags, rely on the evaluation
  615.     order and specify them all in one call.
  616.  
  617.  
  618.  
  619.    TAGS
  620.     (Tags marked with two asterisks "**", are mutely exclusive. That means
  621.     you may only specify one of those in each fplSend() call!)
  622.  
  623.     ** FPLSEND_CONFIRM
  624.       Used to confirm or deny an FPL action. This tag answers TRUE or
  625.       FALSE. Ex: when a program supplied by you is allowed and about to be
  626.       flushed, FPL will call you with the FPL_FLUSH_FILE ID and you must
  627.       return a positive confirmation if you flushed.
  628.  
  629.     ** FPLSEND_STRING
  630.       Sends a string pointer for FPL to copy. Use this only if the current
  631.       function is supposed to return a string. See also the FPLSEND_STRLEN
  632.       tag. A NULL pointer is treated the same as a pointer to a zero length
  633.       string.
  634.  
  635.       FPLSEND_STRLEN
  636.       Used together with FPLSEND_STRING. This informs FPL about the length
  637.       of the sent string. If you set this to a negative number (or don't
  638.       set it at all), FPL will perform a strlen() on the associated string
  639.       pointer to get the length of it.
  640.  
  641.       FPLSEND_DONTCOPY_STRING                (V6)
  642.       Enter TRUE/FALSE, default is FALSE. Use this tag if the string sent
  643.       to FPL is allocated with fplAllocString(). That will tell FPL to not
  644.       duplicated the entered string, but instead using it as it is. Do not
  645.       modify the string in any way after calling fplSend() with this tag.
  646.  
  647.     ** FPLSEND_INT
  648.       Sends an integer value to FPL. Use this only if the current function
  649.       is supposed to return an integer.
  650.  
  651.     * FPLSEND_FLUSHCACHE
  652.       Tells FPL to flush (empty) all internal memory caches. This will
  653.       bring more free memory to the system, but also make FPL require a
  654.       larger number of allocations.
  655.  
  656.     * FPLSEND_FLUSHFILE
  657.       If a file name is specified, that file will be flushed from memory if
  658.       not in use and not previously flushed. Specifying zero (0) will
  659.       flush all files in memory that fits the same description. Even files
  660.       that have been declared to remain cached will be flushed when this is
  661.       used.
  662.  
  663.     * FPLSEND_FREEFILE
  664.       Deletes all functions that are currently associated with the file
  665.       name you specify as data to this tag.
  666.  
  667.     * FPLSEND_GETCOLUMN
  668.       Supply a pointer to a `long' to receive the number of the current
  669.       column the interpreter is working on.
  670.       NOTE: If using fplExecuteFile(), the program will always be read as
  671.       if it was on one single line which will make the column number to be
  672.       very large sometimes.
  673.  
  674.     * FPLSEND_GETFUNCTION                    (V5)
  675.       Supply a pointer to a fuunction pointer to receive the pointer to
  676.       the current interface function.
  677.  
  678.     * FPLSEND_GETINTERVAL                    (V5)
  679.       Supply a pointer to a fuunction pointer to receive the pointer to
  680.       the current interval function.    
  681.  
  682.     * FPLSEND_GETLINE
  683.       Supply a pointer to a `long' to receive the number of the current
  684.       line the interpreter is working on.
  685.       NOTE: If using fplExecuteFile(), the program will always be read as
  686.       if it was on one single line which will make this tag always return
  687.       1.
  688.  
  689.     * FPLSEND_GETNEWLINE_HOOK                (V5)
  690.       Supply a pointer to a fuunction pointer to receive the pointer to
  691.       the current newline hook function.    
  692.  
  693.     * FPLSEND_GETPROG                    (V5)
  694.       Supply a pointer to a char pointer and you'll receive a pointer to
  695.       the current (now interpreting or last interpreted) program. If the
  696.       program wasn't accesible by some reason, a NULL pointer will be
  697.       returned. Use this for e.g. count the lines of a program loaded
  698.       with fplExecuteFile().
  699.  
  700.     * FPLSEND_GETPROGNAME
  701.       Supply a pointer to a char pointer and you'll receive a pointer to
  702.       the current (now interpreting or last interpreted) program name.
  703.       (See also the FPLTAG_PROGNAME tag for the fplExecute#? functions.)
  704.  
  705.     * FPLSEND_GETRESULT
  706.       Supply a pointer to a 'long' to receive the number returned by the
  707.       last interval function call.
  708.  
  709.     * FPLSEND_GETRETURNCODE
  710.       Supply a pointer to a `long' to receive the value returned in the
  711.       last return() or exit() call in the FPL program.
  712.  
  713.     * FPLSEND_GETSTACKSIZE
  714.       (Amiga only) Supply a pointer to a `long' to receive the current
  715.       stack size.
  716.  
  717.     * FPLSEND_GETSTACKUSED
  718.       (Amiga only) Supply a pointer to a `long' to receive the current
  719.       amount stack used.
  720.  
  721.     * FPLSEND_GETSYMBOL_FUNCTIONS
  722.       FPLSEND_GETSYMBOL_MYFUNCTIONS
  723.       FPLSEND_GETSYMBOL_FPLFUNCTIONS
  724.       FPLSEND_GETSYMBOL_VARIABLES
  725.       FPLSEND_GETSYMBOL_CACHEDFILES
  726.       FPLSEND_GETSYMBOL_ALLVARIABLES            (V5)
  727.       FPLSEND_GETSYMBOL_ALLFUNCTIONS            (V5)
  728.  
  729.       Supply a struct fplSymbol ** (pointer to a fplSymbol struct pointer)
  730.       and receive data about the current FPL status!
  731.  
  732.       FUNCTIONS means all exported and external functions
  733.       MYFUNCTIONS means only all external functions
  734.       FPLFUNCTIONS means only by FPL exported functions.
  735.       VARIABLES means all exported variables
  736.       CACHEDFILES means all cached files' names
  737.       ALLVARIABLES means *all* current variables even locals
  738.       ALLFUNCTIONS means *all* current functions even locals
  739.  
  740.       FPLSEND_GETSYMBOL_FREE
  741.       Must be called after each of the above with the fplSymbol pointer as
  742.       data.
  743.  
  744.     * FPLSEND_GETUSERDATA
  745.       Supply a pointer to a `long' to receive the userdata specified in the
  746.       `FPLTAG_USERDATA' tag's data field in the fplInit() call. If that
  747.       tag wasn't specified, NULL is returned.
  748.  
  749.     * FPLSEND_GETVIRLINE                    (V5.3)
  750.       Supply a pointer to a `long' to receive the virtual line number.
  751.       The virtual line number is in normal cases the desired line number
  752.       you want. It is simply a counter of the amount of newlines from the
  753.       top of the file to the current position.
  754.  
  755.       See also: #line instruction in FPLuser.guide
  756.  
  757.     * FPLSEND_GETVIRFILE                    (V5.3)
  758.       Supply a pointer to a char pointer, and you'll receive the virtual
  759.       file name. The virtual file name is usually the name of the current
  760.       file. The file name is zero terminated if it's _not_ started with a
  761.       quotation mark. If a quotation mark is the first character of the
  762.       file name, the file name is also ended with a quotation mark and
  763.       not with a zero byte! After a program execution, this will return
  764.       NULL!
  765.  
  766.       See also: #line instruction in FPLuser.guide
  767.  
  768.     * FPLSEND_PROGRAMFILE
  769.       When using non-cached files and FPL requires a file using the
  770.       FPL_FILE_REQUEST, you return the file name where FPL can load the
  771.       FPl program using this tag. The program must not been changed since
  772.       FPL played with it last time!
  773.       The name must be zero terminated.
  774.  
  775.     ** FPLSEND_PROGRAM
  776.       When using non-cached files and FPL requires a file using the
  777.       FPL_FILE_REQUEST, you return the program array pointer using this
  778.       tag. The program must not been changes since FPL played with it last
  779.       time!
  780.  
  781.     * FPLSEND_SETPROGNAME
  782.       Supply a pointer to the new name of the current program.
  783.       See FPLTAG_PROGNAME.
  784.  
  785.     * FPLSEND_SETFILENAMEGET
  786.       Supply a boolean whether FPL can get flushed file from the file named
  787.       as the program name. See FPLTAG_FILENAMGET.
  788.  
  789.     * FPLSEND_STEP
  790.       Moves the current interpret position forward or backward a number of
  791.       characters. Especially when a FPL_WARNING is received, this function
  792.       might be useful. For example, if a FPL_MISSING_BRACKET occurs on a
  793.       line like `foobar[2[="username"'; The warning will appear at the
  794.       postion          ^ and try to continue there if a confirm is sent
  795.       back. A continuation that will lead to a dead end error if the
  796.       interpret position isn't moved first one character forward.
  797.  
  798.       Using a negative number moves it backwards, positive forwards.
  799.  
  800.       If the beginning, or end, of program was reached, FPL_UNEXPECTED_END
  801.       is returned.
  802.  
  803.       WARNING! This must be used with common sense! Moving the interpret
  804.       position without a reason as above or similar, will deeply confuse
  805.       FPL, which likely starts reporting mysterious errors and in other
  806.       ways act strange.
  807.  
  808.    RESULT
  809.     Zero if ok, otherwise a standard FPL error code.
  810.  
  811.    INPUTS
  812.     void *key    - The return code of the fplInit() call.
  813.     unsigned long *    - A taglist pointer.
  814.  
  815.    SEE ALSO
  816.  
  817. fpl.library/fplAlloc                                 fpl.library/fplAlloc
  818.  
  819.    NAME
  820.     fplAlloc -- allocate memory and bind to the FPL resource list.
  821.  
  822.    SYNOPSIS
  823.     void *fplAlloc( key, size );             (V3)
  824.     D0        A0   D0
  825.  
  826.    FUNCTION
  827.     This function allocates memory and attaches it to the current internal
  828.     list of memory used in this FPL session. All memory in that list will
  829.     be freed at the fplFree() call. Single memory areas allocated with this
  830.     function can be freed with fplDealloc().
  831.  
  832.     If you have patched the FPL allocation routine, this will eventually
  833.     call that function to allocate.
  834.  
  835.     This allocation works like the C language malloc(), which means that it
  836.     always allocates 12 extra bytes to store allocation information in.
  837.  
  838.     Future versions of FPL might get special fplSend() tags to use if you
  839.     have fplAlloc()'ed memory that you send to it to reduce the situations
  840.     where you allocate memory for a string, send it to FPL which allocates
  841.     again and copies your data, and then you free your memory again... One
  842.     too many allocations I think!
  843.  
  844.    RESULT
  845.     A pointer to an allocated memory area, or NULL if the allocation
  846.     failed.
  847.  
  848.    INPUTS
  849.     void *key    - The return code of the fplInit() call.
  850.     unsigned long     - Size of allocation.
  851.  
  852.    SEE ALSO
  853.     fplAlloca(), fplDealloc(), fplDealloca()
  854.  
  855. fpl.library/fplDealloc                                fpl.library/fplDealloc
  856.  
  857.    NAME
  858.     fplDealloc -- deallocated memory allocate with fplAlloc().
  859.  
  860.    SYNOPSIS
  861.     void fplDealloc( key, pointer );         (V3)
  862.              A0   A1
  863.  
  864.    FUNCTION
  865.     This function frees memory previously allocated by fplAlloc(). Using
  866.     this on memory allocated by any other memory will trash memory and
  867.     the resulting happenings are really not known!
  868.  
  869.     If you have patched the FPL deallocation routine, this will eventually
  870.     call that function to free.
  871.  
  872.    INPUTS
  873.     void *key    - The return code of the fplInit() call.
  874.     void *pointer     - Pointer to a previosly fplAlloc()'ed memory area.
  875.  
  876.    SEE ALSO
  877.     fplAlloca(), fplAlloc(), fplDealloca()
  878.  
  879. fpl.library/fplAlloca                                fpl.library/fplAlloca
  880.  
  881.    NAME
  882.     fplAlloca -- allocate memory and bind to the FPL program running.
  883.  
  884.    SYNOPSIS
  885.     void *fplAlloca( key, size );             (V4)
  886.     D0         A0   D0
  887.  
  888.    FUNCTION
  889.     This function allocates memory and attaches it to the current internal
  890.     list of memory used for this FPL session. All memory in that list will
  891.     be freed at the fplFree() call or when the current program exits.
  892.     Single memory areas allocated with this function can be freed with
  893.     fplDealloca().
  894.  
  895.     If you have patched the FPL allocation routine, this will eventually
  896.     call that function to allocate, even though this allocation is using
  897.     the internal FPL memory chaches, which might give us memory without
  898.     calling that allocate function!
  899.  
  900.     This allocation works like the C language malloc(), which means that
  901.     it always allocates 12 extra bytes to store allocation information in.
  902.  
  903.    RESULT
  904.     A pointer to an allocated memory area, or NULL if the allocation
  905.     failed.
  906.  
  907.    INPUTS
  908.     void *key    - The return code of the fplInit() call.
  909.     unsigned long     - Size of allocation.
  910.  
  911.    SEE ALSO
  912.     fplAlloc(), fplDealloc(), fplDealloca()
  913.  
  914. fpl.library/fplDealloca                              fpl.library/fplDealloca
  915.  
  916.    NAME
  917.     fplDealloca -- dealloc memory allocated with fplAlloca().
  918.  
  919.    SYNOPSIS
  920.     void fplDealloca( key, pointer );         (V4)
  921.               A0   A1
  922.  
  923.    FUNCTION
  924.     This function frees memory previously allocated by fplAlloca(). Using
  925.     this on memory allocated by any other memory will trash memory and
  926.     the resulting happenings are really not known!
  927.  
  928.     If you have patched the FPL deallocation routine, this might eventually
  929.     call that function to free if the memory area does not remain in the
  930.     FPL memory cache.
  931.  
  932.    INPUTS
  933.     void *key    - The return code of the fplInit() call.
  934.     void *pointer     - Pointer to a previosly fplAlloca()'ed memory area.
  935.  
  936.    SEE ALSO
  937.     fplAlloca(), fplDealloc(), fplAlloc()
  938.  
  939. fpl.library/fplAllocString                              fpl.library/fplAllocString
  940.  
  941.    NAME
  942.     fplAllocString -- allocate memory for an FPL string.
  943.  
  944.    SYNOPSIS
  945.     void *fplAllocString( key, size);         (V6)
  946.                   A0   D0
  947.  
  948.    FUNCTION
  949.     This function allocates memory and prepares the memory block for
  950.     holding an FPL string. Using this to allocate memory and then
  951.     using the 'FPLSEND_DONTCOPY_STRING' tag in the fplSend() call when
  952.     sending the allocated string to FPL, tells FPL not to duplicate
  953.     the sent string, but simply using the supplied one.
  954.  
  955.     Strings allocated with fplAllocString() should have a matching
  956.     fplFreeString(). Note that when i.g, sending the string to FPL with
  957.     the 'FPLSEND_DONTCOPY_STRING' tag, FPL will do the freeing and
  958.     not the user program!
  959.  
  960.    INPUTS
  961.     void *key    - The return code of the fplInit() call.
  962.     long size    - The length of the string to create. Which is the
  963.               same as the size of the memory block to get hands
  964.               on.
  965.  
  966.    RESULT
  967.     Returns a pointer to the requested memory area. The memory is set up
  968.     to be used as an FPL string (but you won't notice that).
  969.  
  970.    EXAMPLE
  971.     Previous code that send a string to FPL could look like:
  972.         {
  973.           char *data= malloc(1000); /* allocate */
  974.           strcpy(data, otherdata);  /* copy data *
  975.           fplSendTags(key, FPLSEND_STRING, data, TAG_DONE);
  976.           /* FPL duplicates the data sent */
  977.           free(data); /* free */
  978.         }
  979.  
  980.     Code using the new fplAllocString() function could replace the
  981.     old one like:
  982.         {
  983.           char *data = fplAllocString(key, 1000); /* allocate */
  984.           strcpy(data, otherdata);  /* copy data */
  985.           fplSendTags(key, FPLSEND_STRING, data,
  986.                    FPLSEND_DONTCOPY_STRING, TRUE,
  987.                    TAG_DONE);
  988.           /* FPL uses the user's allocation, no extra duplication */
  989.         }
  990.  
  991.    SEE ALSO
  992.     fplAlloc(), fplFreeString()
  993.  
  994. fpl.library/fplFreeString                              fpl.library/fplFreeString
  995.  
  996.    NAME
  997.     fplFreeString -- free FPL string memory.
  998.  
  999.    SYNOPSIS
  1000.     void fplFreeString( key, string);         (V6)
  1001.                  A0   A1
  1002.  
  1003.    FUNCTION
  1004.     This function frees the memory associated with an FPL string. Other
  1005.     memory areas should and can not be freed with this function. Such an
  1006.     attempt will most likely damage running programs.
  1007.  
  1008.     This function should be called after each call to fplAllocString().
  1009.  
  1010.    INPUTS
  1011.     void *key    - The return code of the fplInit() call.
  1012.     char *string    - The return code an fplAllocString() call.
  1013.  
  1014.    EXAMPLE
  1015.     When using the fplExecuteScript() tag 'FPLTAG_STRING_RETURN' the
  1016.     returned string should be freed using fplFreeString():
  1017.         {
  1018.           char *string;
  1019.           fplExecuteScriptTags(key, array, lines,
  1020.                        FPLTAG_STRING_RETURN, &string,
  1021.                        FPLTAG_DONE);
  1022.           if(string) {
  1023.             printf("The program returned '%s'\n", string);
  1024.             fplFreeString(key, string); /* free string */
  1025.           }
  1026.           else
  1027.             printf("No string returned!\n");
  1028.         }
  1029.  
  1030.    SEE ALSO
  1031.     fplDealloc(), fplAllocString()
  1032.  
  1033. fpl.library/fplOpenLib                              fpl.library/fplOpenLib
  1034.  
  1035.    NAME
  1036.     fplOpenLib -- open funclib.
  1037.  
  1038.    SYNOPSIS
  1039.     long fplOpenLib( key, funclib, version, flags);         (V7)
  1040.              A0   A1       D0       D1
  1041.  
  1042.    FUNCTION
  1043.     Opens a funclib. This does mainly the same as the 'openlib' FPL
  1044.     function. Good to use when you want your software to open funclibs
  1045.     as default. Funclibs opened with this function can be made impossible
  1046.     to close from FPL (see the flags parameter).
  1047.  
  1048.     If the funclib is already opened, the open counter is simply
  1049.     increased.
  1050.  
  1051.    INPUTS
  1052.     void *key    - The return code of the fplInit() call.
  1053.     char *funclib    - The name of the funclib to open.
  1054.     long version    - The lowest acceptable funclib version.
  1055.     long flags    - Extra open information. These flags are available:
  1056.  
  1057.     FPLLIB_KEEP: A funclib opened with this flag set cannot be closed with
  1058.     an ordinary 'closelib' but must be closed using the FPLLIB_FORCE flag
  1059.     to fplCloseLib()!
  1060.  
  1061.    RESULT
  1062.     Zero if ok. If the result is a positive number it is a standard FPL
  1063.     error code, and if it is a negative number, it is an error code
  1064.     returned from the funclib. The numbers mean:
  1065.     -1 = the funclib was called with an illegal parameter
  1066.     -2 = funclib internal error
  1067.     -3 = failed getting system resource (pipe, message port, etc)
  1068.     -4 = out of memory
  1069.     -5 = couldn't load funclib (most likely, the funclib is missing)
  1070.     -6 = the requested version didn't exist
  1071.  
  1072.     More error codes will be added in the future.
  1073.  
  1074.    EXAMPLE
  1075.     Make your program use the funclib "foobar" version 2 from startup:
  1076.         {
  1077.           long success;
  1078.           success = fplOpenLib(key, "foobar", 2, FPLLIB_NONE);
  1079.           if(0 == success)
  1080.             printf("We failed to opened the funclib!\n");
  1081.         }
  1082.  
  1083.    SEE ALSO
  1084.     fplCloseLib()
  1085.  
  1086. fpl.library/fplCloseLib                              fpl.library/fplCloseLib
  1087.  
  1088.    NAME
  1089.     fplCloseLib -- close funclib.
  1090.  
  1091.    SYNOPSIS
  1092.     long fplCloseLib( key, funclib, flags )             (V7)
  1093.               A0   A1       D0
  1094.  
  1095.    FUNCTION
  1096.     Closes a funclib. This does mainly the same as the 'closelib' FPL
  1097.     function. Good to use when you want your software to close funclibs.
  1098.     Funclibs opened with the FPLLIB_FORCE flag set can only be closed
  1099.     using this function.
  1100.  
  1101.     The funclib isn't entirely removed until the open counter of the
  1102.     funclib has reached zero. To force removal, without considering
  1103.     the open counter, the FPLLIB_FORCE flag must be used.
  1104.  
  1105.    INPUTS
  1106.     void *key    - The return code of the fplInit() call.
  1107.     char *funclib    - The name of the funclib to open. If set to NULL,
  1108.               *all* funclib will be closed.
  1109.     long flags    - Extra close options. These flags are available:
  1110.  
  1111.     FPLLIB_FORCE: A funclib opened with this flag set cannot be closed with
  1112.     an ordinary 'closelib' but must be closed using the FPLLIB_FORCE flag
  1113.     to fplCloseLib()!
  1114.  
  1115.    RESULT
  1116.     Zero if ok. If the result is a positive number it is a standard FPL
  1117.     error code, and if it is a negative number, it is an error code
  1118.     returned from the funclib. See fplOpenLib() for more details.
  1119.  
  1120.    EXAMPLE
  1121.     Make your program use the funclib "foobar" version 2 from startup:
  1122.         {
  1123.           long success;
  1124.           success = fplOpenLib(key, "foobar", 2, FPLLIB_NONE);
  1125.           if(0 == success)
  1126.             printf("We failed to opened the funclib!\n");
  1127.         }
  1128.  
  1129.    SEE ALSO
  1130.     fplCloseLib()
  1131.  
  1132.